package com.team2.shoppingService;
import java.util.ArrayList;
import java.util.List;

import com.team2.shared.*;
public class ProductFetchThread extends Thread {
	private List<ServerProduct> products;
	private String source;
	private String tags;
	
	public ProductFetchThread (String source, String tags){
		super("Product searching thread");
		this.source = source;
		this.tags = tags;
	}
	
	@Override
	public void run() {
		ShoppingRequest request = new WebParserShoppingRequest(this.source, this.tags);
		products = request.execute();
	}

	public List<ServerProduct> getProducts() {
		if(products==null){
			return new ArrayList<ServerProduct>();
		}
		return products;
	}


}
